/**
 * 新建弹出框->方案筛选
 * @type {[type]}
 */

import React,{PropTypes,Component,PureComponent}  from 'react';
import {Button ,Tree ,Modal, Form, Input, TreeSelect,Row,Col } from 'antd';
import { connect } from 'dva';

const TreeNode = TreeSelect.TreeNode;

const SchemeSelect = ({dispatch,fundpool}) => {
  if(fundpool.Homestatus){
    const {filterList} = fundpool;
    function onChange  (value, label, extra)  {
      const infoId = extra.triggerNode.props.eventKey;
      const infoName = extra.triggerNode.props.title;
      if(infoId == '0-1'){
        return
      }
      dispatch({
        type:"fundpool/getSchemeFitkpi",
        payload:{
          schemeId:infoId,
          schemeName:infoName
        }
      })
    }
    return (
      <TreeSelect
        showSearch
        style={{ width: 150 }}
        dropdownStyle={{ maxHeight: 200, overflow: 'auto' }}
        placeholder="筛选方案"
        treeDefaultExpandAll
        onChange={onChange}
        defaultValue="默认方案"
      >
        <TreeNode value="" title="筛选方案" key="0-1" >
             {
               filterList.map((item,index) => <TreeNode value={item.schemeName}   title={item.schemeName}  key={item.schemeId} />)
             }
        </TreeNode>
      </TreeSelect>
    )
  }else {
    return null;
  }

}

SchemeSelect.propTypes = {}

export default connect(({fundpool})=>({fundpool}))(SchemeSelect)
